package usbcali.edu.persistencia.dto;

import usbcali.edu.persistencia.ComposicionSala;

import usbcali.edu.presentation.backEndBeans.ComposicionSalaView;

import java.io.Serializable;

import java.util.Date;

import javax.faces.event.ActionEvent;


/**
*
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class ComposicionSalaDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String codSala_Salas;
    private String codCompsala;
    private String codSala;
    private boolean rowSelected = false;
    private ComposicionSalaView composicionSalaView;
    private ComposicionSala composicionSala;

    public ComposicionSala getComposicionSala() {
        return composicionSala;
    }

    public String listener_update(ActionEvent e) {
        try {
            composicionSalaView.action_modifyWitDTO(((codCompsala == null) ||
                codCompsala.equals("")) ? null : new String(codCompsala),
                ((codSala == null) || codSala.equals("")) ? null
                                                          : new String(codSala)
                );
            rowSelected = !rowSelected;
        } catch (Exception ex) {
            return "";
        }

        return "";
    }

    public void listener_cancel(ActionEvent e) {
        codCompsala = composicionSala.getId().getCodCompsala().toString();
        codSala = composicionSala.getId().getCodSala().toString();
        codSala_Salas = (composicionSala.getSalas().getCodSala() != null)
            ? composicionSala.getSalas().getCodSala().toString() : null;
        rowSelected = !rowSelected;
    }

    /**
    * <p>Bound to commandLink actionListener in the ui that renders/unrenders
        * the Customer details for editing.</p>
        */
    public void toggleSelected(ActionEvent e) {
        codCompsala = composicionSala.getId().getCodCompsala().toString();
        codSala = composicionSala.getId().getCodSala().toString();
        codSala_Salas = (composicionSala.getSalas().getCodSala() != null)
            ? composicionSala.getSalas().getCodSala().toString() : null;
        rowSelected = !rowSelected;
    }

    public void setComposicionSala(ComposicionSala composicionSala) {
        this.composicionSala = composicionSala;
    }

    public ComposicionSalaView getComposicionSalaView() {
        return composicionSalaView;
    }

    public void setComposicionSalaView(ComposicionSalaView composicionSalaView) {
        this.composicionSalaView = composicionSalaView;
    }

    public String getCodSala_Salas() {
        return codSala_Salas;
    }

    public void setCodSala_Salas(String codSala_Salas) {
        this.codSala_Salas = codSala_Salas;
    }

    public String getCodCompsala() {
        return codCompsala;
    }

    public void setCodCompsala(String codCompsala) {
        this.codCompsala = codCompsala;
    }

    public String getCodSala() {
        return codSala;
    }

    public void setCodSala(String codSala) {
        this.codSala = codSala;
    }

    public boolean isRowSelected() {
        return rowSelected;
    }

    public void setRowSelected(boolean rowSelected) {
        this.rowSelected = rowSelected;
    }
}
